home *** CD-ROM | disk | FTP | other *** search
/ BBS Toolkit / BBS Toolkit.iso / wildcat / todaychg.zip / TODAYCHG.PAS < prev   
Pascal/Delphi Source File  |  1992-09-19  |  1KB  |  75 lines

  1. Program Today_Change;
  2.  
  3. {$M 8192,0,0}
  4.  
  5. Uses Dos;
  6.  
  7. Const
  8.   Months : Array [1..12] of String[3] =
  9.              ('JAN','FEB','MAR','APR','MAY','JUN',
  10.               'JUL','AUG','SEP','OCT','NOV','DEC');
  11.  
  12. Var
  13.   Year,
  14.   Month,
  15.   Last_Month,
  16.   Day,
  17.   Day_of_Week : Word;
  18.   Mon_S,
  19.   L_Mon_S     : String[3];
  20.   Path_to_ZIP : String;
  21.  
  22. Procedure Usage;
  23.  
  24. Begin
  25.  
  26.   Writeln ('USAGE : Todaychg <path to TODAY???.ZIP files>');
  27.   Writeln;
  28.   Halt (1);
  29.  
  30. End;
  31.  
  32. Procedure Get_Month;
  33.  
  34. Begin
  35.  
  36.   GetDate(Year,Month,Day,Day_of_Week);
  37.   If Month=1 Then Last_Month := 12 Else Last_Month := Month - 1;
  38.   Mon_S := Months[Month];
  39.   L_Mon_S := Months[Last_Month];
  40.  
  41. End;
  42.  
  43. Procedure Unzip_this_Month;
  44.  
  45. Begin
  46.  
  47.   SwapVectors;
  48.   Exec(GetEnv('COMSPEC'),'/C'+'PKUNZIP '+Path_to_ZIP+'TODAY'+Mon_S+' TODAY.'+Mon_S);
  49.   SwapVectors;
  50.  
  51. End;
  52.  
  53. Procedure Delete_last_Month;
  54.  
  55. Begin
  56.  
  57.   SwapVectors;
  58.   Exec(GetEnv('COMSPEC'),'/C'+'Del TODAY.'+L_Mon_S);
  59.   SwapVectors;
  60.  
  61. End;
  62.  
  63. { *** Main Program *** }
  64.  
  65. Begin
  66.  
  67.   If ParamCount <> 1 Then Usage;
  68.   Path_to_ZIP := ParamStr(1);
  69.   Get_Month;
  70.   If Day=1 Then Begin
  71.     Unzip_this_Month;
  72.     Delete_last_Month;
  73.   End;
  74.  
  75. End.